﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace helicopterFight
{
    /*
     * Klasa wyświetlająca kompas na mapie.
     * Wskazuje kierunek helikopter, umożliwia zidentyfikowanie pozycji na mapie.
     */
    public class Compass
    {
        private Texture2D rose, flower;
        private Game1 game;

        public Compass(Game1 game)
        {
            this.game = game;
            rose = game.Content.Load<Texture2D>("indicators/rose");
            flower = game.Content.Load<Texture2D>("indicators/flower");
        }

        public void draw(SpriteBatch sb, Vector3 rotation)
        {
            sb.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.Immediate, SaveStateMode.SaveState);

                int x = 15 + (rose.Width / 2);
                int y = game.graphics.PreferredBackBufferHeight - (rose.Height / 2) - 15;
                //sb.Draw(rose, new Rectangle(x, y, rose.Width, rose.Height), Color.White);
                sb.Draw(rose, new Vector2(x, y), new Rectangle(0, 0, rose.Width, rose.Height), Color.White, rotation.Y,
                    new Vector2(rose.Width / 2, rose.Height / 2), 1.0f, SpriteEffects.None, 0.0f);
                sb.Draw(flower, new Vector2(x, y), new Rectangle(0, 0, rose.Width, rose.Height), Color.White, 0,
                    new Vector2(rose.Width / 2, rose.Height / 2), 1.0f, SpriteEffects.None, 0.0f);
            
            sb.End();
        }
    }
}
